package com.appspot.didit.client.user;

import com.appspot.didit.client.BaseView;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.Widget;

public class AuthenticationView extends Composite implements AuthenticationPresenter.View {
	
	final TabPanel panel;
	final DialogBox db;

	
	public AuthenticationView() {
		
    	panel = new TabPanel();
    	
        db = new DialogBox();
		db.setWidget(panel);
		db.show();
		db.center();
		
    }
	
	public Widget getWidget() {
        return this;
	}
	
	public void addLogin(BaseView view) {
		panel.setVisible(true);
		panel.add(view.getWidget(), "Login");
		panel.selectTab(0);
	}

	public void addRegister(BaseView view) {
		panel.add(view.getWidget(), "Create an Account");
	}

	public void reset() {
		panel.clear();	
	}
	
	public void showAuthentication() {
		db.show();
	}
}
